import * as _api from '@/api/system/resourceApi'

const state = {}

const mutations = {}

const actions = {
  // page
  page({ commit, state }, params) {
    return new Promise((resolve, reject) => {
      _api.page(params)
        .then(data => {
          resolve(data)
        })
        .catch(error => {
          reject(error)
        })
    })
  },
  // tree
  tree({ commit, state }, params) {
    return new Promise((resolve, reject) => {
      _api.tree(params)
        .then(data => {
          resolve(data)
        })
        .catch(error => {
          reject(error)
        })
    })
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
